/**
  * Author: Mei
  * Date: 2020-11-20 15:34
  * Description: 
  *
  */
#include <iostream>
#include <vector>
#include <algorithm>
#include <memory>
#include <utility>

using namespace std;

template<typename T, typename... Ts>
std::unique_ptr<T> make_unique(Ts &&... params) {
    return std::unique_ptr<T>(new T(std::forward<Ts>(params)...));
}

int main() {
    auto basicLambda = [] {
        cout << "hello" << endl;
    };
    auto basicLambda1 = [](int value) {
        cout << "hello: " << value << endl;
    };
    auto basicLambda2 = [](int key, int value) -> double { return key + value; };

    double data = 1.2333;
    auto basicLambda3 = [data](int key, int value)mutable -> double {
        data = 3.3333;
        cout << data << endl;
    };
    double &&data1 = 3.6543;
    auto basicLambda4 = [&data1](int key, int value)mutable -> double {
        data1  = 82;
        //cout << data << endl;
    };
    basicLambda4(22, 33);
    cout << data1 << endl;

    //auto isGreaterThan = [](int i) { return i > 100; };
    //vector<int> ints{11, 22, 33, 44, 55};
    //auto it = find_if(ints.cbegin(), ints.cend(), isGreaterThan);
    //
    //    cout << "Found a value > 100: " << *it << endl;
    //if (it != ints.cend()) {
    //}

    //auto myPtr = make_unique<double>(3.2222);
    //auto mylambda = [myPtr = std::move(myPtr)] {
    //    cout << *myPtr << endl;
    //};
    //mylambda();



    return 0;
}